// A-S-M team
// Project: BattleCity
// Created: 23.03.2011
// Last change: 24.03.2011
// Description: class-singleton "Painter" draws all objects of game

#pragma once
#include <ClanLib/display.h>
#include <string>

class Painter
{

// sigleton pattern implementation
public:
	static Painter * getInstance()
	{
		if (!p_instance)
			p_instance = new Painter();
		return p_instance;
	}
private:
	Painter() {	}
    Painter(const Painter&);  
    Painter& operator=(Painter&);
	static Painter * p_instance;

// class itself
public:
	void init(CL_GraphicContext &gc, float multiplier) {
		_gc = gc; 
		_multiplier = multiplier;
	}	// must be called before first use
	void clear();
	void drawPoint(float x, float y, float size);	// test...
	void drawText(float x, float y, std::string text);
	void drawSprite(float x, float y, CL_Sprite* sprite);
	void drawSpritePart(float x, float y, CL_Sprite* sprite, CL_Rectf src);
	void drawGrid();
	CL_Sprite* loadSprite(CL_String sprite_name);
private:
	CL_GraphicContext _gc;
	float _multiplier;
};